import random
from socket import *

serverSocket = socket(AF_INET, SOCK_DGRAM)#创建套接字
serverSocket.bind(('', 12000))#将套接字与端口绑定

while True:
    rand = random.randint(0, 10)#生成随机数
    message, address = serverSocket.recvfrom(1024)#接收信息
    message = message.upper()
    if rand < 4:
        continue
    serverSocket.sendto(message, address)#发送信息